<?php

namespace MyBlog\Http\Controllers\backend;

use Illuminate\Support\Facades\View;
use MyBlog\Models\Member;
use Illuminate\Support\Facades\Input;

class MemberController extends BaseController
{
    public function index() {
        $members = Member::where('id', '>', '0');
        if(!empty(Input::get('username'))) {
        	$members = $members->where('username', 'like', '%'.Input::get('username').'%');
        }
        if(!empty(Input::get('cellphone'))) {
        	$members = $members->where('cellphone', 'like', '%'.Input::get('cellphone').'%');
        }
        if(!empty(Input::get('email'))) {
        	$members = $members->where('email', 'like', '%'.Input::get('email').'%');
        }
        if(!empty(Input::get('gender'))) {
        	$members = $members->where('gender', Input::get('gender'));
        }
        $members = $members->paginate(30);
        return View::make('backend.members', compact('members'));
    }

    public function destory() {

    }
}
